package com.chen.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

@Controller
@RequestMapping("/html")
public class Controller_forward_redirect {

    //重定向~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    //绝对路径
    @RequestMapping("/test1")
    public String test1(){
        return "redirect:/html/login.html";
    }

    @RequestMapping("/test2")
    public String test2(){
        return "redirect:login.html";
    }

    //相对路径

    //请求转发~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    //绝对路径1
    @RequestMapping("/test3")
    public String test3(){
        return "forward:/html/login.html";
    }

    //绝对路径2
    @RequestMapping("/test4")
    public String test4(){
        return "login";
    }

    //相对路径
    @RequestMapping("/test5")
    public String test5(){
        return "forward:login.html";
    }
}
